Guide build-plugin on pre-request auth scripts - #93
Conversation
📝 WalkthroughWalkthroughThe build-plugin documentation now describes custom authentication pre-request scripts, their configuration and runtime behavior, execution timing, token caching, and optional scaffolding. The skill version and authentication planning guidance were updated. ChangesCustom authentication documentation
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.claude/skills/build-plugin/references/metadata.md:
- Around line 245-251: Add timeout or cancellation handling to the auth fetch in
the pre-request hook, using an AbortSignal or the platform’s documented fetch
timeout mechanism. Ensure hung auth requests terminate within a defined limit so
plugin streams and imports cannot stall indefinitely.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: 1f6180fa-4098-414a-b307-ea301e879c1c
📒 Files selected for processing (3)
.claude/skills/build-plugin/SKILL.md.claude/skills/build-plugin/references/data-streams.md.claude/skills/build-plugin/references/metadata.md
clarkd
left a comment
There was a problem hiding this comment.
Looks spot on - thanks for picking up this chunk of work from Wayne!
|
@andrewmumblebee I think this might need updating to place prerequest.js at the root? |
WebAPI base plugin 1.8.0 (squaredup-plugin-repository PR #1966, SAAS-8337) adds datasource-level pre-request scripting so plugins can handle custom auth flows no authMode expresses — token-exchange steps and per-request HMAC signing. The matching saas change lets a declarative plugin's base.config reference the script as a file under dataStreams/scripts/preRequest/, inlined at deploy time. The build-plugin skill had no coverage of this, so an agent building a plugin for such an API had no supported path. Add a reference section beside the auth patterns in metadata.md covering when to reach for a script (and to prefer built-in authModes first), the wiring including scriptingVariables and the reserved scriptState property, the script's variable scope, and a token-exchange example with state-cached expiry drawn from the PR's real N-Able script. Phase 1's auth step and the post-request-scripts section point at it, keeping the full material in one place per the skill-writing guidance. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
e9ed698 to
791a5dd
Compare
🧩 Plugin PR Summaryℹ️ No plugins were modified in this PR. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.claude/skills/build-plugin/references/metadata.md:
- Around line 252-257: Update the failed-response branch in the token exchange
flow to throw the same error message immediately after api.report.error, making
the failure terminal and preventing resp.json() and subsequent token access from
running. Keep the existing success path unchanged.
In @.claude/skills/build-plugin/SKILL.md:
- Line 6: Update the skill metadata version from 1.0.0 back to the intended
0.0.12. Only retain 1.0.0 if the corresponding release metadata and PR objective
are explicitly updated to reflect a major-version release.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: b75a7243-2e81-4283-afba-b1817ed30616
📒 Files selected for processing (3)
.claude/skills/build-plugin/SKILL.md.claude/skills/build-plugin/references/data-streams.md.claude/skills/build-plugin/references/metadata.md
📋 Summary
Adds guidance to the
build-pluginskill for the newpreRequestScriptcapability arriving with WebAPI base plugin 1.8.0 (squaredup/squaredup-plugin-repository#1966, SAAS-8337) and its saas-side deploy support, so an agent building a plugin for an API with a custom auth flow (token exchange, per-request HMAC signing) has a supported path.references/metadata.md, co-located with the auth patterns: when to reach for a script (prefer built-inauthModes first), wiring viascriptingVariablesand thedataStreams/scripts/preRequest/<plugin>.jsfile reference, the reservedscriptStateproperty, the script's variable scope, and a token-exchange example withstate-cached expiry drawn from the real N-Able script in the upstream PR.SKILL.md, the scaffold file tree, and the post-request-scripts section ofreferences/data-streams.md.Note: end-to-end this depends on both upstream PRs shipping — WebAPI 1.8.0 and the saas file-reference inlining.
🔍 Scope of change
📚 Checklist
🤖 Generated with Claude Code
Summary by CodeRabbit